package net.siren93.smh.service.impl;

import net.siren93.smh.dao.EmployeeDao;
import net.siren93.smh.entity.EmployeeEntity;
import net.siren93.smh.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by siren93 on 15/9/25.
 */
@Service("employeeService")
public class EmployeeServiceImpl implements EmployeeService {

    @Autowired
    private EmployeeDao employeeDao;

    public EmployeeEntity findByName(String name) {
        return employeeDao.findByName(name);
    }

    public EmployeeEntity findById(int id) {
        return employeeDao.get(id);
    }

    public Integer save(EmployeeEntity entity) {
        return employeeDao.save(entity);
    }

    public void saveOrUpdate(EmployeeEntity entity) {
        employeeDao.saveOrUpdate(entity);
    }

    public List<EmployeeEntity> findAll() {
        return employeeDao.findAll();
    }

    public void delById(int id) {
        employeeDao.delete(id);
    }

    @Override
    public List<EmployeeEntity> findByPage(int page, int rows) {
        return employeeDao.findByPage(page, rows);
    }
}
